﻿using System;

namespace Safebrowsing
{
    /// <summary>
    /// Sets maintenance policy for the database.
    /// </summary>
    public class DbMaintenancePolicy
    {
        /// <summary>
        /// Creates an instance of the DbMaintenancePolicy with default values
        /// </summary>
        public DbMaintenancePolicy()
        {
            IdleTimeBeforeReindex = Constants.IDLE_TIME_BEFORE_REINDEX;
            IdleTimeBeforeVacuum = Constants.IDLE_TIME_BEFORE_VACUUM;
            VacuumPeriod = Constants.VACUUM_PERIOD;
            ReindexPeriod = Constants.REINDEX_PERIOD;
            DbMaintenanceTimerPeriod = Constants.DB_MAINTENANCE_TIMER_PERIOD;
        }

        /// <summary>
        /// Maintenance timer period. Default value is 1 hour.
        /// </summary>
        public int DbMaintenanceTimerPeriod { get; set; }

        /// <summary>
        /// Idle time before maintenance thread will vacuum the database. Default is 15 minutes.
        /// </summary>
        public TimeSpan IdleTimeBeforeVacuum { get; set; }

        /// <summary>
        /// Idle time before maintenance thread will reindex the database. Default is 15 minutes.
        /// </summary>
        public TimeSpan IdleTimeBeforeReindex { get; set; }

        /// <summary>
        /// Period in which maintenance thread will vacuum the database. Default is 7 days.
        /// </summary>
        public TimeSpan VacuumPeriod { get; set; }

        /// <summary>
        /// Period in which maintenance thread will reindex the database. Default is 14 days.
        /// </summary>
        public TimeSpan ReindexPeriod { get; set; }
    }
}
